<?php
session_start();
header('Content-Type:text/html;charset=utf-8');
date_default_timezone_set("PRC");
require_once($_SERVER['DOCUMENT_ROOT'].'/public/func.php');
$config=require_once($_SERVER['DOCUMENT_ROOT'].'/public/config.php');
$config1=require_once($_SERVER['DOCUMENT_ROOT'].'/public/config1.php');
$config2=require_once($_SERVER['DOCUMENT_ROOT'].'/public/config2.php');
isset($_SESSION['vip']['account'])?($account=$_SESSION['vip']['account']):'';
isset($account)?($arr=selects($config,'vip',"where `account`='$account'")[0]):'';
$warr0=selects($config,'article',"");
$warr1=timeselect($config2,'article',"");
//var_dump($warr1);
$carr=selects($config,'classify',"");
$keywords=empty($_POST['keywords'])?'':$keywords=$_POST['keywords'];
$where=empty($_POST['cid'])?('where `title` like '.'"%'.$keywords.'%"'):('where `cid`='.$_POST['cid'].'&&`title` like '.'"%'.$keywords.'%"');
$warr=select($config1,'article',$where);
//var_dump($warr17['title']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>个人博客</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <!-- Bootstrap styles -->
    <link rel="stylesheet" href="/home/css/bootstrap.min.css">
   
    <!-- Font-Awesome -->
    <link rel="stylesheet" href="/home/css/font-awesome/css/font-awesome.min.css">

    <!-- Google Webfonts -->
    

    <!-- Styles -->
    <link rel="stylesheet" href="/home/css/style.css">

    <!--[if lt IE 9]>      
        <script src="js/vendor/google/html5-3.6-respond-1.1.0.min.js"></script>
    <![endif]-->
    <link rel="style1" href="/home/css/style1.css">
    
</head>
<body>
    <header>
        <div class="widewrapper masthead">
            <div class="container">
                <a href="index.html" id="logo">
                    <img src="img/logo.png" alt="clean Blog">
                </a>

                <div id="mobile-nav-toggle" class="pull-right">
                    <a href="#" data-toggle="collapse" data-target=".clean-nav .navbar-collapse">
                        <i class="fa fa-bars"></i>
                    </a>
                </div>

                <nav class="pull-right clean-nav">
                    <div class="collapse navbar-collapse">
                        <ul class="nav nav-pills navbar-nav">
                            <li>
                                <a href="/home/landing/index.php">登陆</a>
                            </li>
                            <li>
                                <a href="/home/index.php">首页</a>
                            </li>
                            <li>
                                <a href="/home/about.php">关于我</a>
                            </li>
                            <li>
                                <a href="/home/contact.php">留言板</a>
                            </li>
                            <li>
                                <a href="/home/destroy.php">
                                退出</a>
                            </li>                        
                        </ul>
                    </div>
                </nav>        

            </div>
        </div>

        <div class="widewrapper subheader">
            <div class="container">
                <div class="clean-breadcrumb">
                    <a href="/home/landing/editor/index.php"><?php
                    echo (isset($arr['pname'])?'欢迎'.$arr['pname']:'');?>&nbsp;个人博客</a>
                </div>

                <div class="clean-searchbox">
                    <form action="#" method="post" accept-charset="utf-8">
                    <select name="cid" id="fenlei">
                                <option value="">全部</option>
                                <?php
                                foreach ($carr as $k => $v) {
                                echo '<option value="'.$v['id'].'">'.$v['cname'].'</option>';

                                }
                                ?>
                                </select>&nbsp;&nbsp;&nbsp;
                        <input class="searchfield" id="searchbox" name="keywords" value="" type="text" placeholder="搜索">
                        <button class="searchbutton" type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </form>
                </div>
            </div>
        </div>
    </header>

    <div class="widewrapper main">
        <div class="container">
            <div class="row">
                <div class="col-md-8 blog-main">
                    <div class="row">
                    <?php 
                    foreach($warr as $v){
                        echo 
                        '<div class="col-md-6 col-sm-6">
                            <article class=" blog-teaser">
                                <header>
                                    <img src="'.$v['mfile'].'" alt="">
                                    <h3><a href="/home/more/3.php?id='.$v['id'].'">'.$v['title'].'</a></h3>
                                    <span class="meta">'.date('Y-m-d H:i:s',$v['ctime']).','.$v['autor'].'</span>
                                    <hr>
                                </header>
                                <div class="body">
                                    '.mb_substr($v['content'],0,15,'utf-8').'
                                </div>
                                <div class="clearfix">
                                    <a href="/home/more/3.php?id='.$v['id'].'" class="btn btn-clean-one">查看全部</a>
                                </div>
                            </article>
                        </div>';
                    }
                    ?> 
                    <center>
                    第<?php echo $_SESSION['p']; ?>页&nbsp;
                        <a href="/home/index.php?p=<?php echo $_SESSION['first']?>">首页</a>&nbsp;
                        <a href="/home/index.php?p=<?php echo $_SESSION['prev']?>">上一页</a>&nbsp;
                        <a href="/home/index.php?p=<?php echo $_SESSION['next']?>">下一页</a>&nbsp;
                        <a href="/home/index.php?p=<?php echo $_SESSION['countpage']?>">尾页</a>&nbsp;
                        共<?php echo $_SESSION['countpage']?>页
                    </center>
                    </div>
                    <div class="paging">
                        <a href="#" class="older"><i></i></a>
                    </div>
                </div>
                <aside class="col-md-4 blog-aside">
                    
                    <div class="aside-widget">
                        <header>
                            <h3>精品文章</h3>
                        </header>
                        <div class="body">
                            <ul class="clean-list">
                            <?php
                            foreach ($warr0 as $k => $v) {
                          echo '<li><a href="/home/more/3.php?id='.$v['id'].'">'.$v['title'].'</a></li>';
                                /*<li><a href="">Responsive Pricing Table</a></li>
                                <li><a href="">Yellow HTML5 Template</a></li>
                                <li><a href="">Blackor Responsive Theme</a></li>
                                <li><a href="">Portfolio Bootstrap Template</a></li>
                                <li><a href="">Clean Slider Template</a></li>';*/
                            }
                            ?>
                            </ul>
                        </div>
                    </div>
                
                    <div class="aside-widget">
                        <header>
                            <h3>相关帖子</h3>
                        </header>
                        <div class="body">
                            <ul class="clean-list">
                              <?php
                            foreach ($warr0 as $k => $v) {
                          echo '<li><a href="/home/more/3.php?id='.$v['id'].'">'.$v['title'].'</a></li>';
                                /*<li><a href="">Blackor Responsive Theme</a></li>
                                <li><a href="">Portfolio Bootstrap Template</a></li>
                                <li><a href="">Clean Slider Template</a></li>
                                <li><a href="">Clean - Responsive HTML5 Template</a></li>
                                <li><a href="">Responsive Pricing Table</a></li>
                                <li><a href="">Yellow HTML5 Template</a></li>*/
                                 }
                            ?>
                            </ul>
                        </div>
                    </div>

                    <div class="aside-widget">
                        <header>
                            <h3>标签</h3>
                        </header>
                        <div class="body clearfix">
                            <ul class="tags">
                              <?php
                            foreach ($warr0 as $k => $v) {
                          echo '<li><a href="/home/more/3.php?id='.$v['id'].'">'.$v['tags'].'</a></li>';
                                /*<li><a href="#">HTML5</a></li>
                                <li><a href="#">CSS3</a></li>
                                <li><a href="#">COMPONENTS</a></li>
                                <li><a href="#">TEMPLATE</a></li>
                                <li><a href="#">PLUGIN</a></li>
                                <li><a href="#">BOOTSTRAP</a></li>
                                <li><a href="#">TUTORIAL</a></li>
                                <li><a href="#">UI/UX</a></li>*/ 
                                }
                            ?>                           
                            </ul>
                        </div>
                    </div>
                </aside>
            </div>
        </div>
    </div>

    <footer>
        <div class="widewrapper footer">
            <div class="container">
                <div class="row">
                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-user"></i>关于我</h3>

                       <p>一个程序员</p>
                       <p>刚开始接触php，学习完善技术是我现在的目标</p>
                    </div>

                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-pencil"></i>最近的帖子</h3>
                        <ul class="clean-list">
                        <?php
                            foreach ($warr1 as $k => $v) {
                          echo '<li><a href="/home/more/3.php?id='.$v['id'].'">'.$v['title'].'</a></li>';
                            /*<li><a href="">Clean - Responsive HTML5 Template</a></li>
                            <li><a href="">Responsive Pricing Table</a></li>
                            <li><a href="">Yellow HTML5 Template</a></li>
                            <li><a href="">Blackor Responsive Theme</a></li>
                            <li><a href="">Portfolio Bootstrap Template</a></li>
                            <li><a href="">Clean Slider Template</a></li>*/
                                }
                            ?>  
                        </ul>
                    </div>

                    <div class="col-md-4 footer-widget">
                        <h3> <i class="fa fa-envelope"></i>联系我</h3>

                        <p>邮箱:1440342422@qq.com</p>
                        <p>电话 17671786038</p>
                         <div class="footer-widget-icon">
                            <i class="fa fa-facebook"></i><i class="fa fa-twitter"></i><i class="fa fa-google"></i>
                        </div>
                    </div>
                   
                </div>
            </div>
        </div>
        <div class="widewrapper copyright">
                Copyright 2015 More Templates <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a>
        </div>
    </footer>
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/modernizr.js"></script>

</body>
</html>

